<?php

/**
 * This is the model class for table "tlb_user".
 *
 * The followings are the available columns in table 'tlb_user':
 * @property integer $id
 * @property string $user_name
 * @property string $join_date
 * @property string $point_hientai
 * @property string $point_nap
 * @property string $point_rut
 * @property string $point_change
 * @property string $Status
 * @property integer $VIPER
 */
class TlbUser extends CActiveRecord
{
	/**
	 * Returns the static model of the specified AR class.
	 * @param string $className active record class name.
	 * @return TlbUser the static model class
	 */
	public static function model($className=__CLASS__)
	{
		return parent::model($className);
	}

	/**
	 * @return string the associated database table name
	 */
	public function tableName()
	{
		return 'tlb_user';
	}

	/**
	 * @return array validation rules for model attributes.
	 */
	public function rules()
	{
		// NOTE: you should only define rules for those attributes that
		// will receive user inputs.
		return array(
			array('user_name, join_date', 'required'),
			array('VIPER', 'numerical', 'integerOnly'=>true),
			array('user_name', 'length', 'max'=>45),
			array('point_hientai, point_nap, point_rut, point_change', 'length', 'max'=>8),
			array('Status', 'length', 'max'=>15),
			// The following rule is used by search().
			// Please remove those attributes that should not be searched.
			array('id, user_name, join_date, point_hientai, point_nap, point_rut, point_change, Status, VIPER', 'safe', 'on'=>'search'),
		);
	}

	/**
	 * @return array relational rules.
	 */
	public function relations()
	{
		// NOTE: you may need to adjust the relation name and the related
		// class name for the relations automatically generated below.
		return array(
		);
	}

	/**
	 * @return array customized attribute labels (name=>label)
	 */
	public function attributeLabels()
	{
		return array(
			'id' => 'ID',
			'user_name' => 'User Name',
			'join_date' => 'Join Date',
			'point_hientai' => 'Point Hientai',
			'point_nap' => 'Point Nap',
			'point_rut' => 'Point Rut',
			'point_change' => 'Point Change',
			'Status' => 'Status',
			'VIPER' => 'Viper',
		);
	}

	/**
	 * Retrieves a list of models based on the current search/filter conditions.
	 * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
	 */
	public function search()
	{
		// Warning: Please modify the following code to remove attributes that
		// should not be searched.

		$criteria=new CDbCriteria;

		$criteria->compare('id',$this->id);
		$criteria->compare('user_name',$this->user_name,true);
		$criteria->compare('join_date',$this->join_date,true);
		$criteria->compare('point_hientai',$this->point_hientai,true);
		$criteria->compare('point_nap',$this->point_nap,true);
		$criteria->compare('point_rut',$this->point_rut,true);
		$criteria->compare('point_change',$this->point_change,true);
		$criteria->compare('Status',$this->Status,true);
		$criteria->compare('VIPER',$this->VIPER);

		return new CActiveDataProvider($this, array(
			'criteria'=>$criteria,
		));
	}
}